package com.candy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.candy.bean.Userinfo;
import com.candy.dao.UserinfoMapper;
import com.candy.service.IUserinfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author maxuejiao
 * @since 2025-08-20
 */
@Service
public class UserinfoServiceImpl extends ServiceImpl<UserinfoMapper, Userinfo> implements IUserinfoService {

    @Autowired
    UserinfoMapper userinfoMapper;

    @Override
    public boolean login(Userinfo userinfo) {
//        拼接查询条件
        QueryWrapper queryWrapper=new   QueryWrapper();
//        根据用户名密码进行等值查询
        queryWrapper.eq("username",userinfo.getUsername());
        queryWrapper.eq("userpwd",userinfo.getUserpwd());
        Userinfo userinfo1=userinfoMapper.selectOne(queryWrapper);
//        若用户输入信息正确，则userinfo不为空，则但会true
        if(userinfo1!=null){
            return true;
        }
        return false;
    }
}
